{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "什么时候不用列表\n",
    "# 举例\n",
    "person1 = ['ford prefect','male','researcher','betelgeuse seven']\n",
    "print(person1)\n",
    "person2 = ['name','ford perfect','gender','male',\n",
    "           'occupation','researcher','home planet','betelgeuse seven']\n",
    "print(person2)\n",
    "# 由以上举例表明，当需要处理结构化数据时，应避免使用列表。\n",
    " 用切片[:] 等价于copy()方法\n",
    "names_网新4_数据备份 = names_网新4[:]\n",
    "print(names_网新4)\n",
    "print(names_网新4_数据备份)\n",
    "names_网新1.append('hy')\n",
    "print('names_网新4:',names_网新4)\n",
    "print('names_网新4_数据备份:',names_网新4_数据备份)\n",
    "\n",
    "stu_id = [91,96,95,97,90,89,93]\n",
    "#. count() 查看元素出现的次数/统计数量\n",
    "print(stu_id.count(90))\n",
    "删除90的值\n",
    "#：remove 怎么删\n",
    "while True:\n",
    "    if 90 in stu_id:\n",
    "        stu_id.remove(90)\n",
    "    else:\n",
    "        break\n",
    "        # 使用remove仅能删除第一个90\n",
    "print(stu_id)\n",
    "# 使用if else循环删除数据\n",
    "pop()\n",
    "print(stu_id.index(91)\n",
    "# 此时index仅能查询列表中的第一个91的索引值\n",
    "for index,item in enumerate(stu_id):\n",
    "    print(index,item)\n",
    "    if item == 91:\n",
    "        print(index)\n",
    "        stu_id.pop(index) # pop是删除索引值，remove删除内容\n",
    "        print(stu_id)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}